<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%@include file="../../common.jsp"%>
<link rel="stylesheet" href="${staticPath}/css/common.css">
<c:set var="titleStr" value="${goodsQueryBean.keyWord}"></c:set>
<c:choose>
	<c:when test="${titleStr==null||titleStr==''}">
		<c:set var="titleStr" value="${goodsQueryBean.typeClassName}"></c:set>
	</c:when>
	<c:otherwise>
		<c:set var="titleStr" value="${titleStr}-商品搜索"></c:set>
	</c:otherwise>
</c:choose>
<c:if test="${titleStr==null||titleStr==''}">
	<c:set var="titleStr" value="${goodsQueryBean.goodsClassName}"></c:set>
</c:if>
<c:if test="${titleStr==null||titleStr==''}">
	<c:set var="titleStr" value="商品列表"></c:set>
</c:if>
<title>${titleStr}</title>
<style>
<!--
#search_div {
	background-color: white;
}

.search_cancle {
	margin-left: 10px;
	line-height: 28px;
	white-space: nowrap;
	color: #6091ed;
}
.weui-row .weui-col-20{
    width: 20%;
    width: calc((100% - 15px*4) / 5);
    border-radius: 10px;
}
[class*="weui-col-"] {
    border: 1px solid #ccc;
    height: 40px;
    line-height: 40px;
    text-align: center;
}
.weui-row > [class*="col-"] {
    box-sizing: border-box;
}
.weui-row > [class*="col-"] a{
	color: #666;
}
.price2{
	text-decoration: line-through;
	color: #999;
}
-->
</style>
</head>
<body onload="revertScene();">
	<input id="total_pages" type="hidden" value="${pageResult.totalPages}" />
	<input id="goodsClassId" type="hidden" name="goodsClassId" value="${goodsQueryBean.goodsClassId}" />
	<input id="page" type="hidden" name="page" value="${pageResult.number}" />
	<input id="sort_input" type="hidden" name="sort" value="${goodsQueryBean.sort}" />
	<input id="brandId" type="hidden" name="brandId" value="${goodsQueryBean.brandId}" />
	<input id="typeClass" type="hidden" name="typeClass" value="${goodsQueryBean.typeClass}" />
	<input id="keyWord" type="hidden" name="keyWord" value="${goodsQueryBean.keyWord}" />
	<input id="goodsState" type="hidden" name="goodsState" value="${goodsQueryBean.goodsState}" />
	<header class="OldHeader" id="header_div" style="z-index: 10; position: fixed;">
		<div class="OHeader" >
			<h1>商品列表</h1>
			<div class="OHeadBack">
				<a href="javascript:history.go(-1);"><img src="${staticPath}/images/back.png" style="margin: auto;"></a>
			</div>
		</div>
		<div class="centerOHeadset" style="z-index: 10;position: fixed;" >
			<a href="#" onclick="javascript:showSearchBar();"><img src="${staticPath}/images/search.png"></a>
		</div>
	</header>
	<div id="header_space_div" class="clear" style="clear: both;"></div>
	<div class="weui_tab" id='tab-title'>
		<div class="weui_navbar">
			<a class="weui_navbar_item weui_bar_item_on sort_a" orderType="desc" col="id"> 综合</a> 
			<a class="weui_navbar_item sort_a" orderType="desc" col="salenum"> 销量</a> 
			<a class="weui_navbar_item sort_a" orderType="desc" col="price2">${3==goodsQueryBean.goodsState?'积分':'价格'}<i></i></a> 
		</div>
		<div class="weui_tab_bd">
			<div id="content" class="weui_tab_bd_item weui_tab_bd_item_active" style="overflow-x: hidden;width: 100%">
				<div class="weui-pull-to-refresh-layer">
					<div class="pull-to-refresh-arrow"></div>
					<div class="pull-to-refresh-preloader"></div>
					<div class="down" style="width: 80px;">下拉刷新</div>
					<div class="up">释放刷新</div>
					<div class="refresh">正在刷新...</div>
				</div>
				<div class="content-padded" id="goods_list" style="">
					<c:if test="${pageResult.totalElements==0}">
						<div style="text-align: center;width: 100%;margin-top: 100px">
						<input type="hidden" value="1" id="emptyListFlag" />
						抱歉，没有找到符合条件的商品
						</div>
					</c:if>
					<c:forEach items="${pageResult.content}" var="goods">
						<a href="<%=appPath%>/goods/${goods.id}.html" onclick="recordScene();" class="weui_media_box weui_media_appmsg goods_link" gid="${goods.id}">
							<div class="weui_media_hd">
							<!-- 
								<img class="weui_media_appmsg_thumb" src="${goods.image}" alt="">
							 -->
								<img class="lazy-img weui_media_appmsg_thumb" data-original="${goods.image}">
							</div>
							<div class="weui_media_bd">
								<h4 class="weui_media_title">${goods.name}</h4>
								<c:choose>
									<c:when test="${goods.points!=null&&goods.points!=0}">
										<span class="weui_media_title2">${goods.points}积分</span>
									</c:when>
									<c:otherwise>
										<span class="weui_media_title2">￥<fmt:formatNumber value="${goods.price2/100}" pattern="0.00"/></span>
										<span class="price2">￥<fmt:formatNumber value="${goods.price/100}" pattern="0.00"/></span>
									</c:otherwise>
								</c:choose>
								<p class="weui_media_desc">
									销量${goods.salenum==null?0:goods.salenum}<span style="padding-left: 20px;">评论${goods.evaluationCount==null?0:goods.evaluationCount}</span>
								</p>
							</div>
						</a> 
					</c:forEach>
				</div>
				<div class="weui-infinite-scroll" id="loading-div" style="display:none;">
				  <div class="infinite-preloader"></div>
					  正在加载... 
				</div>
			</div>
		</div>
	</div>
	<!-- -------搜索框 start---------- -->
	<div id="search_div" class="weui-popup-container weui-popup-container-visible" style="display: none">
		<div class="weui_search_bar" id="search_bar">
			<form class="weui_search_outer" action="<%=appPath%>/goods/findPageResult.html">
				<div class="weui_search_inner">
					<i class="weui_icon_search"></i> <input type="search" class="weui_search_input" id="search_input" name="keyWord" value="${goodsQueryBean.keyWord}" placeholder="搜索"
						required /> <a href="javascript:" class="weui_icon_clear" id="search_clear"></a>
				</div>
				<label for="search_input" class="weui_search_text" id="search_text"> <i class="weui_icon_search"></i> <span>搜索</span>
				</label>
			</form>
			<a href="javascript:" class="search_cancle close-popup" id="search_cancel">取消</a>
		</div>

		<div class="list-head">
			<p style="padding-left: 10px; font-size: 18px;">热门推荐</p>
		</div>
		<div class="weui-row">
			<c:forEach items="${popularizeDatas}" var="indexData">
				<div class="weui-col-20">
					<c:choose>
						<c:when test="${9==indexData.dataType}">
							<a href="javascript:toLink('${indexData.dataType}','${indexData.title}','1');">${indexData.title}</a>
						</c:when>
						<c:otherwise>
							<a href="javascript:toLink('${indexData.dataType}','${indexData.dataId}','1');">${indexData.title}</a>
						</c:otherwise>
					</c:choose>
				</div>
			</c:forEach>
		</div>
	</div>
	<!-- -------搜索框 end---------- -->
</body>
<script src="${staticPath}/js/jquery.lazyload.js"></script>
<script src="${staticPath}/js/app/goods/list-by-class.js"></script>
</body>
</html>
